<?php
/**
 * Created by PhpStorm.
 * User: admin
 * Date: 2018/12/31
 * Time: 13:17
 */

namespace app\common\model;


use think\Model;
use QL\QueryList;
class TencentOnline extends Model
{
    /*抓取腾讯在线人数
     * */
    public function fetchData(){
        $url ='https://im.qq.com';
        $content =file_get_contents($url);
        $eles = QueryList::html(  $content)->find('#cur_online');
        $content = $eles->html();
        $qq_online =str_replace(',','',$content);
        if(!is_numeric($qq_online)){
            $file = 'tencent_online';
            Tool::record_log('腾讯数据抓取错误，错误内容为：'.$qq_online,$file);
        }
        $data['qq_online'] =$qq_online;
       return  $this->save($data);
    }


}